package com.cloud.dubbo.consumer.service.impl;

import com.cloud.dubbo.api.dto.StockDto;
import com.cloud.dubbo.api.service.HelloService;
import com.cloud.dubbo.consumer.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * po
 * vo
 * dto
 */
@Service
@Slf4j
public class ProductServiceImpl implements ProductService {

    @DubboReference
    HelloService helloService;
    @Override
    public String createOrder() {
        List<StockDto> stocks = helloService.getStocks(10, 1);
        stocks.forEach(stockDto -> {
            log.info(stockDto.getQuantity() + "");
        });
        return "测试";
    }
}
